#ifndef __ANIMATION_BUILDER_H__
#define __ANIMATION_BUILDER_H__

#include <cocos2d.h>
#include <list>
#include "gofgame/common/Ref.h"
using namespace cocos2d;
using namespace std;
using namespace gofgame::common;

namespace gofgame {
	namespace common {
		namespace sprite {
			/**
			 * Example:
			 * CCAnimate *animate =
			 *		AnimateBuilder("hero.plist")
			 *		.add("hero_1.png")
			 *		.add("hero_1.png")
			 *		.add("hero_1.png")
			 *		.add("hero_1.png")
			 *		.buildAnimate(1.0F / 12);
			 */
			class AnimateBuilder {
			public:
				AnimateBuilder(const char *plistName);
				AnimateBuilder& add(const char *frameName);
				CCAnimate *buildAnimate(float delay = 0) const;
				bool initAnimationMap();

			private:
				/* @Deprecated */ void *operator new(size_t);
				/* @Deprecated */ void operator delete(void*);
			private:
				string plistName;
				list<string> frameNames;
			};
		}
	}
}

#endif //__ANIMATION_BUILDER_H__
